<!doctype html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>多维数据搜索页面</title>
    <script src="/webjars/miniui/boot.js" type="text/javascript"></script>
    <link href="/static/css/resource.css" rel="stylesheet" type="text/css"/>
    <script src="/static/js/common/common.js" type="text/javascript"></script>
    <link href="/webjars/miniui/css/demo.css" rel="stylesheet" type="text/css"/>
    <link href="/static/css/default.css" rel="stylesheet" type="text/css"/>
    <link href="/static/js/bootstrap-4.4.1-dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="/static/js/azbj/search/search.js"></script>
    <style>
        #searchBtn table tr td span {
            padding-left: 10px;
            padding-right: 10px;
        }

        .searchClass {
            color: #ffffff;
            background: #4A89FD;
            border-radius: 3px;
        }
        .disClick{
            cursor: not-allowed;
        }

        .searchTitle {
            line-height: 16px;
            font-size: 12px;
            color: #8B8B8B;
        }

        .searchJsllAll, .searchJsllBtn, .searchAreaAll, .searchAreaBtn, .searchJcyyAll, .searchJcyyBtn, .searchAzAll,
        .searchAzBtn, .searchBjAll, .searchBjBtn, .searchHcAll, .searchHcBtn, .searchXjAll, .searchXjBtn, .searchJcXjBtn, .searchJcXjAll {
            font-size: 12px;
            cursor: pointer;
            margin-left: 1%;
            user-select: none;
            padding: 4px 0.5%;
        }

        .gray {
            font-size: 12px;
            color: #8B8B8B;
        }

        .black {
            font-size: 12px;
        }
        #yazbtn, #azbjbtn, #jcazbtn{
            -webkit-border-radius: 0.25rem 0.25rem 0 0;
            -moz-border-radius: 0.25rem 0.25rem 0 0;
            border-radius: 0.25rem 0.25rem 0 0;
            background: #fff;
            color: #4A89FD;
            border: 1px solid #DCDFE6;
            border-bottom: none;
        }
        #yazbtn.active, #azbjbtn.active, #jcazbtn.active{
            color: #fff;
            background-color: #4A89FD;
            border-color: #4A89FD;
        }
        .btn.focus, .btn:focus {
            outline: 0;
            box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0);
        }
    </style>
</head>
<body style="padding-left: 1%;padding-right: 1%;overflow-y: auto;">
<div style="padding: 5px 0 5px 30%;">
    <div class="row">
        <div class="col-sm-6">
            <div class="form-group">
                <div class="input-group">
                    <input type="text" class="form-control required" id="searchId" name="searchId" placeholder="请输入...">
                    <input type="hidden">
                    <span class="input-group-btn">
                          <button class="btn btn-primary" onclick="toPage(1)">
                              <i class="fa fa-search" aria-hidden="false"></i>
                          </button>
                    </span>
                    <div class="input-group-btn">
                        <ul class="dropdown-menu dropdown-menu-right" role="menu"></ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="/static/js/jquery-3.6.0.min.js"></script>
<script src="/static/js/bootstrap-4.4.1-dist/js/umd/popper.js"></script>
<script src="/static/js/bootstrap-4.4.1-dist/js/bootstrap.min.js"></script>
<script src="/static/js/bootstrap-4.4.1-dist/js/bootstrap-suggest.js"></script>
<script src="/static/js/bootstrap-4.4.1-dist/js/bootstrap-paginator.js"></script>
<script src="/static/js/bootstrap-4.4.1-dist/js/bootstrap-table.js"></script>
<div class="btn-wrapper" style="padding: 0 12px 0 ;margin: 10px 0;border-bottom: 1px solid #dfdfdf;">
    <button type="button" id="yazbtn" class="btn btn-sm active" onclick="showSearchBtn(1)" autocomplete="off"> 预安置管理
    </button>
    <button type="button" id="azbjbtn" class="btn btn-sm " onclick="showSearchBtn(2)" autocomplete="off">安置帮教对象
    </button>
    <button type="button" id="jcazbtn" class="btn btn-sm " onclick="showSearchBtn(3)" autocomplete="off">
        解除安置帮教对象
    </button>
</div>

<div style="padding: 5px 20px;width: 100%;border: 1px solid #dfdfdf;">
    <div id="searchAreaTable"  style="border-bottom: 1px dashed #DCDFE6;padding:8px 0;">
        <table style="width: 100%;" class="form-table">
            <tr>
                <td width="60px" align="left">
                    <span class="searchTitle">地域范围</span>
                </td>
                <td align="left">
                    <span class="searchAreaAll" code="all">全部</span>
                    <#if proList ?? && (proList?size &gt; 0) && (nativePro = '110000' || nativePro = '120100' || nativePro = '310000' || nativePro = '500000') >
                        <#list proList as pro >
                            <#if pro_index &lt; 12>
                                <span code="${pro.id!''}" class="searchAreaBtn" name="nativecou">${pro.proname!''}</span>
                            </#if>
                        </#list>
                    </#if>
                    <#if proList ?? && (proList?size &gt; 0) && nativePro != '110000' && nativePro != '120100' && nativePro != '310000' && nativePro != '500000'>
                        <#list proList as pro >
                            <#if pro_index &lt; 12>
                                <span code="${pro.id!''}" class="searchAreaBtn" name="nativecity">${pro.proname!''}</span>
                            </#if>
                        </#list>
                    </#if>
                    <button type="button" style="margin-left: 20px;" class="btn  btn-default btn-sm"
                            onclick="togglePro()"><i id="toggleProBtn" class="fa fa-angle-down" aria-hidden="true"></i>
                    </button>
                </td>
            </tr>
        </table>
        <div id="searchAreaHideTable">
            <table style="width: 100%;padding: 0px;" class="form-table">
                <tr>
                    <td width="113px" align="right"></td>
                    <td>
                        <#if proList ?? && (proList?size &gt; 0) >
                            <#list proList as pro >
                                <#if pro_index &gt; 11 && pro_index &lt;24>
                                    <span code="${pro.id!''}" class="searchAreaBtn" name="ownpro">${pro.proname!''}</span>
                                </#if>
                            </#list>
                        </#if>
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <#if proList ?? && (proList?size &gt; 0) >
                            <#list proList as pro >
                                <#if pro_index &gt; 23>
                                    <span code="${pro.id!''}" class="searchAreaBtn" name="ownpro">${pro.proname!''}</span>
                                </#if>
                            </#list>
                        </#if>
                    </td>
                </tr>
            </table>
        </div>
    </div>

    <div id="searchJcsjTable"  style="border-bottom: 1px dashed #DCDFE6;padding:8px 0;">
        <table style="width: 100%;" class="form-table">
            <tr>
                <td width="60px" align="left">
                    <span class="searchTitle">解除时间</span>
                </td>
                <td>
                    <input property="editor" style="width: 140px;margin-left: 20px;" class="mini-datepicker"
                           emptyText="起始时间" id="jiechustart" name="jiechustart"/>
                    <span style="font-size: 12px;">至</span>
                    <input property="editor" style="width: 140px" class="mini-datepicker" emptyText="结束时间"
                           id="jiechuend"
                           name="jiechuend"/>
                </td>
            </tr>
        </table>
    </div>
    <div id="searchJcyyTable"  style="border-bottom: 1px dashed #DCDFE6;padding:8px 0;">
        <table style="width: 100%;" class="form-table">
            <tr>
                <td width="60px" align="left">
                    <span class="searchTitle">解除原因</span>
                </td>
                <td>
                    <span class="searchJcyyAll" code="all">全部</span>
                    <span class="searchJcyyBtn" code="1" name="jcyy">期满解除</span>
                    <span class="searchJcyyBtn" code="2" name="jcyy">死亡</span>
                    <span class="searchJcyyBtn" code="3" name="jcyy">重新犯罪</span>
                </td>
            </tr>
        </table>
    </div>
    <div id="searchHjdzTable"  style="border-bottom: 1px dashed #DCDFE6;padding:8px 0;">
        <table style="width: 100%;" class="form-table">
            <tr>
                <td width="60px" align="left">
                    <span class="searchTitle">户籍地址</span>
                </td>
                <td>
                    <input id="nativepro" name="nativepro" class="mini-combobox" emptyText="省"
                           style="width:120px;margin-left: 20px;" textfield="codeName" valueField="codeId"
                           url="/azbj/bjdxInfo/getDepart?codeType=2_1&codeId=-1" onclick="onDeptChanged('province')"
                           onvaluechanged="onValueChanged('province')"/>
                    <input id="nativecity" name="nativecity" class="mini-combobox" emptyText="市" style="width: 120px"
                           textfield="codeName" valueField="codeId"
                           onclick="onDeptChanged('city')" onvaluechanged="onValueChanged('city')"/>
                    <input id="nativecou" name="nativecou" class="mini-combobox" emptyText="区县" style="width: 120px"
                           textfield="codeName" valueField="codeId"
                           onclick="onDeptChanged('couty')" onvaluechanged="onValueChanged('couty')"/>
                    <input id="nativevill" name="nativevill" class="mini-combobox" emptyText="乡镇" style="width: 120px"
                           url="/azbj/bjdxInfo/getStreet?parent_code=${couty!''}" textfield="name" valueField="code"
                           onclick="onDeptChanged('village')"/>
                </td>
            </tr>
        </table>
    </div>
    <div id="searchAzqkTable"  style="border-bottom: 1px dashed #DCDFE6;padding:8px 0;">
        <table style="width: 100%;" class="form-table">
            <tr>
                <td width="60px" align="left">
                    <span class="searchTitle">安置情况</span>
                </td>
                <td width="">
                    <span class="searchAzAll" code="all" name="azzt">全部</span>
                    <span class="searchAzBtn" code="2" name="azzt">已安置</span>
                    <span class="searchAzBtn" code="1" name="azzt">未安置</span>
                </td>
            </tr>
        </table>
    </div>
    <div id="searchBjqkTable"  style="border-bottom: 1px dashed #DCDFE6;padding:8px 0;">
        <table style="width: 100%;" class="form-table">
            <tr>
                <td width="60px" align="left">
                    <span class="searchTitle">帮教情况</span>
                </td>
                <td>
                    <span class="searchBjAll" code="all">全部</span>
                    <span class="searchBjBtn" code="1" name="bjzt">已帮扶</span>
                    <span class="searchBjBtn" code="1" name="jzzt">已救助</span>
                    <span class="searchBjBtn" code="0" name="bjzt">未帮教</span>
                </td>
            </tr>
        </table>
    </div>
    <div id="searchHcqkTable"  style="border-bottom: 1px dashed #DCDFE6;padding:8px 0;">
        <table style="width: 100%;" class="form-table">
            <tr>
                <td width="60px" align="left">
                    <span class="searchTitle">核查情况</span>
                </td>
                <td>
                    <span class="searchHcAll" code="all">全部</span>
                    <span class="searchHcBtn" code="2" name="state">未核查</span>
                    <span class="searchHcBtn" code="1" name="state">等待核查</span>
                    <span class="searchHcBtn" code="3" name="state">核查成功</span>
                    <span class="searchHcBtn" code="4" name="state">核查失败</span>
                </td>
            </tr>
        </table>
    </div>
    <div id="searchXjqkTable" style="padding:8px 0;">
        <table style="width: 100%;" class="form-table">
            <tr>
                <td width="60px" align="left">
                    <span class="searchTitle">衔接情况</span>
                </td>
                <td align="left">
                    <span class="searchXjAll" code="all">全部</span>
                    <span class="searchXjBtn" code="4" name="flag">未衔接</span>
                    <span class="searchXjBtn" code="5" name="flag">待衔接</span>
                    <span class="searchXjBtn" code="1" name="flag">已衔接</span>
                </td>
            </tr>
        </table>
    </div>
    <div id="searchJcXjqkTable" style="padding:8px 0;">
        <table style="width: 100%;" class="form-table">
            <tr>
                <td width="60px" align="left">
                    <span class="searchTitle">衔接情况</span>
                </td>
                <td align="left">
                    <span class="searchJcXjAll" code="all">全部</span>
                    <span class="searchJcXjBtn" code="1" name="flag">未衔接</span>
                    <span class="searchJcXjBtn" code="0" name="flag">已衔接</span>
                </td>
            </tr>
        </table>
    </div>
</div>
<div style="padding: 15px 0 0;text-align: center">
    <button type="button" id="searchBtn" class="mini-button btn-primary" autocomplete="off"
            onclick="toPage(1)">查询
    </button>
    <button type="button" id="resetBtn" onclick="resetSearchBtn" class="mini-button btn-primary"
            autocomplete="off">重置
    </button>
</div>

<div style="width: 100%;padding:0 0 1%;overflow: auto;">
    <table width="100%" id="dataTable" style="height: 100%;overflow: auto">
    </table>
</div>

<div>
    <div style="float: left;padding-left: 20px;padding-top: 10px;font-size: 12px;" id="pageLine">
    </div>
    <div style="float: right" id="paginationDiv">
        <ul class="pagination">
        </ul>
    </div>
</div>
<script type="text/javascript">

    mini.parse();
    var pageNum = 1;//当前页码
    var pageSize = 0;//总页数
    var eachPge = 9;//每页显示数量
    var keywords = "";
    var tog = false;
    var type = 1;//搜索类别：1：预安置；2：安置帮教对象；3：解除安置帮教对象；

    var province = mini.get("nativepro");
    var city = mini.get("nativecity");
    var couty = mini.get("nativecou");
    var village = mini.get("nativevill");


    //初始化
    $(function () {
        //地域隐藏按钮
        togglePro();
        //查询条件按钮
        resetSearchBtn();
        //根据类别展示不同按钮
        showSearchBtn(type);

        $(".searchJcyyBtn,.searchAzBtn,.searchBjBtn,.searchHcBtn,.searchXjBtn,.searchJcXjBtn").click(function () {
            $(this).parent().children().eq(0).removeClass('searchClass');
            $(this).toggleClass('searchClass');
        });
        $(".searchJcyyAll,.searchAzAll,.searchBjAll,.searchHcAll,.searchXjAll,.searchJcXjAll").click(function () {
            $(this).parent().children().removeClass('searchClass');
            $(this).addClass('searchClass');
        });
        $(".searchAreaBtn").click(function () {
            $(".searchAreaAll").removeClass('searchClass');
            $(this).toggleClass('searchClass');
        });
        $(".searchAreaAll").click(function () {
            $(".searchAreaBtn").removeClass('searchClass');
            $(this).addClass('searchClass');
        });
        //处理分页
        $("#paginationDiv ul li").click(function () {
            $("#paginationDiv ul li").removeClass("active");
            $(this).addClass("active");
        });
    });

    //获取数据
    function toPage(pNum) {
        var data = {};
        data.sql = packageCodeData();
        data.keywords = $("#searchId").val();
        data.start = (pNum - 1) * eachPge;
        data.pageSize = eachPge;
        data.searchType = type;
        data.type = "1";
        mini.mask({
            el: document.body,
            cls: 'mini-mask-loading',
            html: '加载中...'
        });
        $.ajax({
            url: "/azbj/solrsearch/solr/saveFuzzySql",
            type: "post",
            data: data,
            success: function (result) {
                $.ajax({
                    url: "/azbj/solrsearch/solr/fuzzySearch",
                    type: "post",
                    data: data,
                    success: function (result) {
                        mini.unmask(document.body);
                        if("0" != result.data.length){
                            pageSize = Math.ceil(result.total / eachPge);
                            autoTable(result.data);
                            autoPage(pNum);
                            $("#pageLine").text(" 共" + result.total + "条记录，共" + pageSize + "页,第" + pageNum + "页");
                        }else{
                            mini.alert("查询结果为空......");
                        }
                    }
                });
            }
        });

    }

    //组装查询条件
    function packageCodeData() {
        var data = {};
        if (type == 1) {
            //监所类型
            //data.jsll = getCode("searchJsllBtn");
            //区域范围
            data.area = getCode("searchAreaBtn");
            //核查情况
            data.hcqk = getCodeNot("searchHcBtn", "4");
            //衔接情况
            data.xjqk = getCodeNot("searchXjBtn", "4");
        } else {
            //户籍所在省
            var province = mini.get("nativepro").getValue();
            data.province = province == "" ? "" : ("nativepro:" + province);
            //户籍所在市
            var city = mini.get("nativecity").getValue();
            data.city = city == "" ? "" : ("nativecity:" + city);
            //户籍所在县
            var couty = mini.get("nativecou").getValue();
            data.couty = couty == "" ? "" : ("nativecou:" + couty);
            //户籍所在乡镇
            var village = mini.get("nativevill").getValue();
            data.village = village == "" ? "" : ("nativevill:" + village);
            //安置情况
            data.azqk = getCodeNot("searchAzBtn", "1");
            //帮教情况
            data.bjqk = getCodeNot("searchBjBtn", "0");
            //衔接情况
            data.xjqk = getCodeNot("searchJcXjBtn", "1");
            if (type == 3) {
                //解除时间
                var jcstart = mini.get("jiechustart").getText();
                var jiechuend = mini.get("jiechuend").getText();
                data.jiechudate = jcstart + jiechuend == "" ? "" : ("jiechudate:[" + (jcstart == "" ? " * " : (jcstart + "T00:00:00Z")) + " TO " + (jiechuend == "" ? " * " : (jiechuend + "T23:59:59Z")) + "]");
                //解除原因
                data.jcyy = getCode("searchJcyyBtn");
            }
        }
        var dataStr = "";
        for (var key in data) {
            if (data[key] != "") {
                dataStr += data[key] + " AND ";
            }
        }
        if(dataStr){
            dataStr = dataStr.substr(0, dataStr.length - 4);
        }

        return dataStr;
    }

    //获取每个条件被选中的code值
    function getCode(classStr) {
        var codeStr = "";
        $("." + classStr + ".searchClass").each(function () {
            var code = $(this).attr("code");
            var name = $(this).attr("name");
            if (code != "all") {
                codeStr += name + ":" + code + " OR ";
            }
        });
        codeStr = codeStr.substr(0, codeStr.length - 3);
        return codeStr;
    }

    //获取每个条件被选中的code值
    function getCodeNot(classStr, uncode) {
        var codeStr = "";
        var flag = true;
        $("." + classStr + ".searchClass").each(function () {
            var code = $(this).attr("code");
            var name = $(this).attr("name");
            if (code == uncode) {
                codeStr = getCodeOther(classStr);
                flag = false;
                return false;
            } else {
                codeStr += name + ":" + code + " OR ";
            }
        });
        if (flag) {
            codeStr = codeStr.substr(0, codeStr.length - 3);
            if(codeStr){
                codeStr = "("+codeStr+")";
            }
        }

        return codeStr;
    }

    //获取不包含sql
    function getCodeOther(classStr) {
        var codeStr = "-(";
        var flag = true;
        $("." + classStr).each(function () {
            if (!$(this).hasClass("searchClass")) {
                flag = false;
                codeStr += $(this).attr("name") + ":" + $(this).attr("code") + " OR ";
            }
        });
        if (flag) {
            return "";
        }
        codeStr = codeStr.substr(0, codeStr.length - 3) + ")";
        return codeStr;
    }

    //地域范围下拉
    function togglePro() {
        $("#searchAreaHideTable").toggle();
        $("#toggleProBtn").toggleClass("fa-angle-down");
        $("#toggleProBtn").toggleClass("fa-angle-up");
    }


    function autoTable(dataList) {
        $("#dataTable").html("");
        var tr = '<tr>';
        for (var i = 0; i < dataList.length; i++) {
            var prinumTemp="\'"+dataList[i].prinum+"\'";
            if(i % 3 == 0){
                tr += '' +
                    '       <td>\n' +
                    '               <div style="margin: 2.5% 3% 2.5% 0;">\n' +
                    '                    <img src="/azbj/search/queryImageData?url=' + encodeURI(dataList[i].fileurl) + '" width="96" height="128" style="border: 0px solid #ccc;float: left;cursor: pointer" onclick = "toViewHjqc(' + (prinumTemp?prinumTemp:'')  + ')" > \n' +
                    '                    <div style="margin-left: 95px;padding-left:3%;text-align: left;height: 128px;border:1px solid #dfdfdf"> \n' +
                    '                        <span style="font-size: 14px;cursor: pointer" onclick = "toViewHjqc(' + (prinumTemp?prinumTemp:'')  + ')" >' + (dataList[i].pname?dataList[i].pname:'') + '</span><span style="font-size: 10px">/' + dataList[i].xb + '</span><br> \n' +
                    '                        <span  class="gray">身份证：</span><span  class="black">' + (dataList[i].idnum?dataList[i].idnum:'')  + '</span><br> \n' +
                    '                        <span  class="gray">服刑单位：</span><span  class="black">' + (dataList[i].pdanweiname?dataList[i].pdanweiname:'') + '</span><br>\n' +
                    '                        <span  class="gray">释放时间：</span><span  class="black">' + (dataList[i].sfsj?dataList[i].sfsj:'') + '</span><br> \n' +
                    '                        <span  class="gray">户籍信息：</span><span title="'+(dataList[i].hjdz?dataList[i].hjdz:'')+'" style="display:inline-block;width: 73%;vertical-align: sub;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" class="black">' + (dataList[i].hjdz?dataList[i].hjdz:'') + '</span><br> \n' +
                    '                    </div>\n' +
                    '                </div>\n' +
                    '       </td>\n';
            }
            if(i % 3 == 1){
                tr += '' +
                    '       <td>\n' +
                    '               <div style="margin: 2.5% 1.5%;">\n' +
                    '                    <img src="/azbj/search/queryImageData?url=' + encodeURI(dataList[i].fileurl) + '" width="96" height="128" style="border: 0px solid #ccc;float: left;cursor: pointer" onclick = "toViewHjqc(' + (prinumTemp?prinumTemp:'') + ')" > \n' +
                    '                    <div style="margin-left: 95px;padding-left:3%;text-align: left;height: 128px;border:1px solid #dfdfdf"> \n' +
                    '                        <span style="font-size: 14px;cursor: pointer" onclick = "toViewHjqc(' + (prinumTemp?prinumTemp:'')  + ')" >' + (dataList[i].pname?dataList[i].pname:'') + '</span><span style="font-size: 10px">/' + dataList[i].xb + '</span><br> \n' +
                    '                        <span  class="gray">身份证：</span><span  class="black">' + (dataList[i].idnum?dataList[i].idnum:'')  + '</span><br> \n' +
                    '                        <span  class="gray">服刑单位：</span><span  class="black">' + (dataList[i].pdanweiname?dataList[i].pdanweiname:'') + '</span><br>\n' +
                    '                        <span  class="gray">释放时间：</span><span  class="black">' + (dataList[i].sfsj?dataList[i].sfsj:'') + '</span><br> \n' +
                    '                        <span  class="gray">户籍信息：</span><span title="'+(dataList[i].hjdz?dataList[i].hjdz:'')+'" style="display:inline-block;width: 73%;vertical-align: sub;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" class="black">' + (dataList[i].hjdz?dataList[i].hjdz:'') + '</span><br> \n' +
                    '                    </div>\n' +
                    '                </div>\n' +
                    '       </td>\n';
            }
            if(i % 3 == 2){
                tr += '' +
                    '       <td>\n' +
                    '               <div style="margin: 2.5% 0 2.5% 3%;">\n' +
                    '                    <img src="/azbj/search/queryImageData?url=' + encodeURI(dataList[i].fileurl) + '" width="96" height="128" style="border: 0px solid #ccc;float: left;cursor: pointer" onclick = "toViewHjqc(' + (prinumTemp?prinumTemp:'')  + ')" > \n' +
                    '                    <div style="margin-left: 95px;padding-left:3%;text-align: left;height: 128px;border:1px solid #dfdfdf"> \n' +
                    '                        <span style="font-size: 14px;cursor: pointer" onclick = "toViewHjqc(' + (prinumTemp?prinumTemp:'')  + ')" >' + (dataList[i].pname?dataList[i].pname:'') + '</span><span style="font-size: 10px">/' + dataList[i].xb + '</span><br> \n' +
                    '                        <span  class="gray">身份证：</span><span  class="black">' + (dataList[i].idnum?dataList[i].idnum:'')  + '</span><br> \n' +
                    '                        <span  class="gray">服刑单位：</span><span  class="black">' + (dataList[i].pdanweiname?dataList[i].pdanweiname:'') + '</span><br>\n' +
                    '                        <span  class="gray">释放时间：</span><span  class="black">' + (dataList[i].sfsj?dataList[i].sfsj:'') + '</span><br> \n' +
                    '                        <span  class="gray">户籍信息：</span><span title="'+(dataList[i].hjdz?dataList[i].hjdz:'')+'" style="display:inline-block;width: 73%;vertical-align: sub;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" class="black">' + (dataList[i].hjdz?dataList[i].hjdz:'') + '</span><br> \n' +
                    '                    </div>\n' +
                    '                </div>\n' +
                    '       </td>\n'+
                    '       </tr>\n';
            } else if (i == (dataList.length - 1)) {
                tr += '</tr>';
                // var trObj = $(tr);
                // trObj.appendTo($("#dataTable"));
                // tr = '<tr>';
            }

        }
        $("#dataTable").html(tr);
    }

    /**
     * 地址选择
     * @param e
     */
    function onDeptChanged(e) {
        // province city  couty village
        if ("province" == e) {
            province.setValue("");
            var url = "/azbj/bjdxInfo/getDepart?codeType=2_1&codeId=-1";
            province.setUrl(url);
            province.select(0);
        }
        if ("city" == e) {
            var codeId = province.getValue();
            if (codeId) {
                city.setValue("");
                var url = "/azbj/bjdxInfo/getDepart?codeType=2_1&codeId=" + codeId;
                city.setUrl(url);
                city.select(0);
            } else {
                return;
            }

        }

        if ("couty" == e) {
            var codeId = city.getValue();
            if (codeId) {
                couty.setValue("");
                var url = "/azbj/bjdxInfo/getDepart?codeType=2_1&codeId=" + codeId;
                couty.setUrl(url);
                couty.select(0);
            } else {
                return;
            }
        }

        if ("village" == e) {
            var parent_code = couty.getValue();
            if (parent_code) {
                village.setValue("");
                var url = "/azbj/bjdxInfo/getStreet?parentCode=" + parent_code;
                village.setUrl(url);
                village.select(0);
                /*couty.select(0);*/
            } else {

            }
        }
    }

    function onValueChanged(e) {
        if ("province" == e) {
            city.setValue("");
            couty.setValue("");
            village.setValue("");
        }
        if ("city" == e) {
            couty.setValue("");
            village.setValue("");
        }

        if ("couty" == e) {
            village.setValue("");
        }

    }

    //查询类别
    function showSearchBtn(e) {
        $('.btn-wrapper .btn').removeClass('active');
        $('.btn-wrapper .btn').eq(e-1).addClass('active');
        resetSearchBtn();
        type = e;
        if (e == 2) {
            $("#searchJcsjTable,#searchJcyyTable,#searchAreaTable,#searchAreaHideTable,#searchHcqkTable,#searchXjqkTable").css("display", "none");
            $("#searchHjdzTable,#searchAzqkTable, #searchBjqkTable, #searchJcXjqkTable").css("display", "block");
        } else if (e == 3) {
            $("#searchAreaTable,#searchHcqkTable, #searchXjqkTable").css("display", "none");
            $("#searchJcsjTable,#searchJcyyTable, #searchHjdzTable, #searchAzqkTable,#searchBjqkTable,#searchJcXjqkTable").css("display", "block");
        } else {
            $("#searchJcsjTable,#searchJcyyTable,#searchHjdzTable,#searchAzqkTable,#searchAreaHideTable,#searchBjqkTable,#searchJcXjqkTable").css("display", "none");
            $("#searchAreaTable, #searchHcqkTable, #searchXjqkTable").css("display", "block");
        }
        toPage(1);
    }

    //重置
    function resetSearchBtn() {
        $(".searchJcyyBtn").removeClass("searchClass");
        $(".searchAzBtn").removeClass("searchClass");
        $('.searchBjBtn').removeClass("searchClass");
        $(".searchHcBtn").removeClass("searchClass");
        $(".searchXjBtn").removeClass("searchClass");
        $('.searchAreaBtn').removeClass("searchClass");
        $('.searchJcXjBtn').removeClass("searchClass");

        $(".searchJcyyAll").addClass("searchClass");
        $(".searchAzAll").addClass("searchClass");
        $(".searchBjAll").addClass("searchClass");
        $(".searchHcAll").addClass("searchClass");
        $(".searchXjAll").addClass("searchClass");
        $(".searchAreaAll").addClass("searchClass");
        $(".searchJcXjAll").addClass("searchClass");

        mini.get("nativepro").setValue();
        mini.get("nativecity").setValue();
        mini.get("nativecou").setValue();
        mini.get("nativevill").setValue();
        mini.get("jiechustart").setValue();
        mini.get("jiechuend").setValue();
    }

    //生成分页栏
    function autoPage(pNum) {
        pageNum = pNum;
        $("#paginationDiv ul").html("");
        if (pageSize < 5) {
            $(autoPageNum(1, pageSize, pageNum)).appendTo($("#paginationDiv ul"));
        } else if (pageNum < 3 && pageSize >= 5) {
            $(autoPageNum(1, 5, pageNum)).appendTo($("#paginationDiv ul"));
        } else if (pageNum >= pageSize - 2) {
            $(autoPageNum(pageSize - 4, pageSize, pageNum)).appendTo($("#paginationDiv ul"));
        } else {
            $(autoPageNum(pageNum - 2, pageNum + 2, pageNum)).appendTo($("#paginationDiv ul"));
        }

    }

    function autoPageNum(pageStart, pageEnd, pNum) {
        var pages = '';
        var first ='';
        var pre = '';
        var next ='';
        var last = '';
        if(pNum==1){
            first = '<li class="page-item"><a class="page-link" style="cursor: not-allowed" href="#">&lt;&lt;</a></li>';
            pre = '<li class="page-item"><a class="page-link" style="cursor: not-allowed" href="#">&lt;</a></li>';
        }else{
            first = '<li class="page-item" onclick="toMovePage(1)"><a class="page-link" href="#">&lt;&lt;</a></li>';
            pre = '<li class="page-item" onclick="toMovePage(2)"><a class="page-link" href="#">&lt;</a></li>';
        }
        if(pNum==pageSize){
            next = '<li class="page-item" ><a class="page-link" href="#"  style="cursor: not-allowed">&gt;</a></li>';
            last = '<li class="page-item" ><a class="page-link" href="#"  style="cursor: not-allowed">&gt;&gt;</a></li>';
        }else{
            next = '<li class="page-item" onclick="toMovePage(3)"><a class="page-link" href="#">&gt;</a></li>';
            last = '<li class="page-item" onclick="toMovePage(4)"><a class="page-link" href="#">&gt;&gt;</a></li>';
        }
        for (var i = pageStart; i < pageEnd + 1; i++) {
            if (pNum == i) {
                pages += '<li class="page-item active "  onclick="toPage(' + i + ')"><a class="page-link" href="#">' + i + '</a></li>';
            } else {
                pages += '<li class="page-item"  onclick="toPage(' + i + ')"><a class="page-link" href="#">' + i + '</a></li>';
            }
        }
        return first + pre + pages + next + last;
    }

    //点击页码跳转
    function toMovePage(e) {
        if (e == 1) {
            toPage(1);
        } else if (e == 2) {
            toPage(pageNum > 1 ? (pageNum - 1) : pageNum);
        } else if (e == 3) {
            toPage(pageNum < pageSize ? (pageNum + 1) : pageNum);
        } else if (e == 4) {
            toPage(pageSize);
        }
    }
</script>

</body>
</html>